package com.Graphics;

import android.content.*;
import android.graphics.*;
import android.view.Display;
import android.view.WindowManager;

public class ColorBall {
	
	//INTEGERS
	private Bitmap cool;
	private int X;
	private int Y;
	private int id;
	private static int countBalls = 1;
	private int vx;
	private int vy;
	private int width;
	private int height;
	
	//METHOD COLORBALL
	public ColorBall(Context cxt, int X, int Y){
		BitmapFactory.Options fact = new BitmapFactory.Options();
		fact.inJustDecodeBounds = true;
		id = countBalls;
		countBalls++;
		this.X = X;
		this.Y = Y;
		vx = 5;
		vy = 5;	
		WindowManager win = (WindowManager)cxt.getSystemService(Context.WINDOW_SERVICE);
		Display display = win.getDefaultDisplay();
		width = display.getWidth();
		height = display.getHeight();
	}
	
	//SET AND GET
	public Bitmap getcool(){
		return cool;
	}
	
	public int getX(){
		return X;
	}
	
	public int getY(){
		return Y;
	}

	public int getvx(){
		return vx;
	}
	
	public int getvy(){
		return vy;
	}
	
	public int getid(){
		return id;
	}
	
	
	public void setX(int newX){
		this.X = newX;
	}
	
	public void setY(int newY){
		this.Y = newY;
	}
	
	public void setvx(int newVX){
		this.X = newVX;
	}
	
	public void setvy(int newVY){
		this.vy = newVY;
	}
	
	//METHOD ON MOVE
	public void onMove(int newX,int newY,ColorBall cb){

		if(X > width){
			this.Y -= vy;
			this.X -= vx;
			vx = -vx; 
		}
		
		if(Y > height - 20){
			this.X -= vx;
			this.Y -= vy;
			vy = -vy;
		}
		
		if(X < 0){
			this.Y -= vy;
			this.X -= vx;
			vx = -vx;
		}
		
		if(Y < 0){
			this.X -= vx;
			this.Y -= vy;
			vy = -vy;
		}
		
		this.X += vx;
		this.Y += vy;
		
		
	}
	
	
}
